package nz.ac.massey.doi_information_extractor.tests;

import static org.junit.Assert.assertFalse;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

import nz.ac.massey.doi_information_extractor.data.Publication;
import nz.ac.massey.doi_information_extractor.parser.CrossrefPlugin;

import org.junit.Before;
import org.junit.Test;

public class CrossrefPluginTest {

	Publication newpub;

	@Before
	public void setUp() throws Exception{
		System.setProperty("http.proxyHost", "tur-cache.massey.ac.nz");
		System.setProperty("http.proxyPort", "8080");

		ExecutorService pool = Executors.newFixedThreadPool(3);
		Callable<Publication> crossrefPlugin = new CrossrefPlugin("10.1016/j.websem.2006.11.007");
		Future<Publication> futureCrossrefPluginResult = pool.submit(crossrefPlugin);

		newpub = futureCrossrefPluginResult.get();
	}

	@Test
	public void testReturnPublication() {
		assertFalse(newpub.equals(null));
	}
}
